package com.only.common.util;

import java.util.Optional;

/**
 * @author only
 * @date 2023/11/8
 * @description
 */
public class StringOption {
    public static Optional<String> stringToOption(String str) {
        return Optional.ofNullable(str).flatMap(k -> {
            if (k.isEmpty()) {
                return Optional.empty();
            } else {
                return Optional.of(k);
            }
        });
    }
}
